package com.ruoyi.machine.base.wearing.service;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.machine.base.wearing.domain.WearingPart;
import com.ruoyi.machine.base.wearing.domain.WearingPartCond;
import com.ruoyi.machine.base.wearing.mapper.WearingPartMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 配件
 */
@Service
public class WearingPartServiceImpl implements IWearingPartService {
    @Autowired
    private WearingPartMapper wearingPartMapper;
    /**
     * 根据搜索条件所有易损件记录
     *
     * @param cond 搜索条件
     * @return
     */
    @Override
    public List<WearingPart> selectWearingPartList(WearingPartCond cond) {
        return wearingPartMapper.selectWearingPartList(cond);
    }

    /**
     * 根据名称和规格查找易损件
     *
     * @param wearingPartName
     * @param wearingPartSpecification
     * @return
     */
    @Override
    public WearingPart selectWearingPartByName(String wearingPartName, String wearingPartSpecification) {
        return wearingPartMapper.selectWearingPartByName(wearingPartName, wearingPartSpecification);
    }

    /**
     * 新增易损件记录
     *
     * @param wearingPart
     * @return
     */
    @Override
    public int insertWearingPart(WearingPart wearingPart) {
        return wearingPartMapper.insertWearingPart(wearingPart);
    }

    /**
     * 修改易损件
     *
     * @param wearingPart
     * @return
     */
    @Override
    public int updateWearingPart(WearingPart wearingPart) {
        return wearingPartMapper.updateWearingPart(wearingPart);
    }

    /**
     * 删除易损件记录
     * 仅修改删除标志
     *
     * @param wearingPart
     * @return
     */
    @Override
    public int updateWearingPartDeleteFlag(WearingPart wearingPart) {
        return wearingPartMapper.updateWearingPartDeleteFlag(wearingPart);
    }
}
